package com.ncloud.timetask.dashboard.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.ncloud.timetask.dashboard.service.DashboardSaleTaskService;



/**
 * @author sundelong
 * project_name: timetask 
 * type_name: DashboardTaskController 
 * date: 2017年6月21日下午4:29:00 
 * 
 */

@Component
public class DashboardSaleTaskController {
	//当前各销售本月订单金额总数
	public static final String COUNT_SALE_FEE_MONTHLY="1007";
	
	@Autowired
	DashboardSaleTaskService sakeTask;
		
	//每天执行一次，将所有销售当月的销售额写入数据库。
	@Scheduled(cron = "0 55 23 * * ? ") //每天23：:55执行
	public void insertSaleCountTask(){
		try {	
			sakeTask.insertSaleCount(COUNT_SALE_FEE_MONTHLY);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
